package com.hl.card.modular.packBack.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.hl.card.common.persistence.dao.ProfitScaleMapper;
import com.hl.card.common.persistence.model.ProfitScale;
import com.hl.card.modular.packBack.service.IProfitScaleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author huangpu
 * @since 2018-06-05
 */
@Service
public class ProfitScaleServiceImpl extends ServiceImpl<ProfitScaleMapper, ProfitScale> implements IProfitScaleService {

    @Resource(name = "profitScaleMapper")
    private ProfitScaleMapper profitScaleMapper;

    @Override
    public List<Map<String, Object>> selectList() {
        List<Map<String, Object>> map = profitScaleMapper.selectProfit();
        return map;
    }

    @Override
    public void save(ProfitScale profitScale) {
        profitScaleMapper.insert(profitScale);
    }

    @Override
    public void delete(int id) {
        profitScaleMapper.deleteById(id);
    }

    @Override
    public void update(ProfitScale profitScale) {
        profitScaleMapper.updateById(profitScale);
    }

    @Override
    public ProfitScale selectById(Integer id) {
        return profitScaleMapper.selectById(id);
    }

    @Override
    public ProfitScale selectByName(String goodsCode) {
        ProfitScale profitScale = profitScaleMapper.selectByName(goodsCode);
        return profitScale;
    }
}
